from sqlalchemy import Boolean, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
#1.用Base类来创建 SQLAlchemy 模型
from db.repository import Base

class User(Base):
    __tablename__ = "users"
    #2.创建模型属性/列
    id = Column(Integer, primary_key=True, index=True)
    username = Column(String, unique=True, index=True)
    password = Column(String, unique=True, index=True)
    # 构造函数
    def __init__(self, id, username):
        self.id = id
        self.username = username

    # 打印形式
    def __str__(self):
        return "id:%s, name:%s" % (str(self.id), self.username)